﻿using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Text;

namespace Net5CommonLib.SystemLib.Common
{
    public class HttpContextManager
    {
        public static HttpContext HttpContext
        {
            get { return DiManager.GetDiObj<IHttpContextAccessor>().HttpContext; }
        }
        /// <summary>
        /// 获取Header头部对应的值
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string GetHeaderPara(string key)
        {
            Microsoft.Extensions.Primitives.StringValues value;
            HttpContext.Request.Headers.TryGetValue(key, out value);
            return value;
        }
    }
}
